package org.andromeo;

public class ARException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3221623824260363399L;

	/**
	 * Holds one of the AREXC-Codes which error has occured
	 */
	public int andromeoException;
	
	/**
	 * A little help method to set an AREXC-Code and return
	 * the exception.
	 * @param arexcCode One of the AREXC*-Constants
	 * @return this ARException
	 */
	public ARException setAndromeoException(final int arexcCode){
		this.andromeoException = arexcCode;
		return ARException.this;
	}
	
	/**
	 * raised when user entered wrong account data
	 */
	public static final int AREXC_WRONG_USER_PASSWORD = 1;
	
	/**
	 * raised when a session-timeout occured
	 */
	public static final int AREXC_SESSION_TIMEOUT = 2;
	
	/**
	 * PlanetRomeo is not reachable
	 * or the base URL (Host) is wrong
	 */
	public static final int AREXC_PLANETROMEO_NOT_REACHABLE = 3;
	
	/**
	 * a parsing exception occured, maybe due to changes on their PHP-Coding
	 * this error should be reported to the developers
	 */
	public static final int AREXC_PARSING_EXCEPTION = 4;
	
/**
 * other failures
 */
	
	public static final int AREXC_OTHER = 9999999;

/**
 * 
 */
public ARException(int arexc) {
	super();
	this.setAndromeoException(arexc);
	// TODO Auto-generated constructor stub
}

/**
 * @param detailMessage
 * @param throwable
 */
public ARException(int arexc,String detailMessage, Throwable throwable) {
	super(detailMessage, throwable);
	this.setAndromeoException(arexc);
	// TODO Auto-generated constructor stub
}

/**
 * @param detailMessage
 */
public ARException(int arexc,String detailMessage) {
	super(detailMessage);
	this.setAndromeoException(arexc);
	// TODO Auto-generated constructor stub
}

/**
 * @param throwable
 */
public ARException(int arexc,Throwable throwable) {
	super(throwable);
	this.setAndromeoException(arexc);
	// TODO Auto-generated constructor stub
}
	
}
